package 网络编程.UDPECHO;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-10-05
 * Time: 16:15
 */
public class UDPDictServer extends UDPSever{
    private Map<String,String> map = new HashMap<>();
    public UDPDictServer(int port) throws SocketException {
        super(port);
        map.put("你好","我草");
        map.put("吃火锅么","好啊好啊");
        map.put("香啊","gun");
        map.put("hello","hi");
    }

    @Override
    public String process(String response) {
        return map.getOrDefault(response,"发错了哥们!!");
    }

    public static void main(String[] args) throws IOException {
        UDPDictServer udpDictServer = new UDPDictServer(8000);
        udpDictServer.start();
    }
}
